// ml:run = $bin < input
// ml:opt = 0
// ml:ccf += -g
#include <iostream>
#include <algorithm>
#include <set>

int const maxn = 200007;
int a[maxn];
int n, s;
int zero;
std::multiset<int> all;


int main()
{
    std::ios::sync_with_stdio(false);
    std::cin >> n >> s;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        std::cin >> a[i];
        if (a[i] == 0 && i != s) { zero++; ans++; }
        if (a[i] && i != s) all.insert(a[i]);
    }
    if (a[s] != 0) ans++;

    for (int i = 1; all.size(); i++) {
        if (*all.begin() == i) {
            while (*all.begin() == i) all.erase(all.begin());
        } else {
            if (zero) { zero--; continue; }
            all.erase(std::prev(all.end()));
            ans++;
        }
    }
    std::cout << ans << "\n";
}

